package model.core;

import model.area_effect.MapAreaOfEffect;
import utility.BidirectionalMap;

public class MapAoEsLibrary {
	private BidirectionalMap<String, MapAreaOfEffect> library = new BidirectionalMap<String, MapAreaOfEffect>();
	
	private static MapAoEsLibrary mLibrary = null;
	
	private MapAoEsLibrary(){
		
	}
	
	public static MapAoEsLibrary getInstance(){
		if (mLibrary == null){
			mLibrary = new MapAoEsLibrary();
		}
		return mLibrary;
	}
	
	public MapAreaOfEffect getMapAreaOfEffect(String name){
		try {
			return library.getFromSecondSet(name).clone();
		} catch (CloneNotSupportedException e) {
			e.printStackTrace();
		}
		return library.getFromSecondSet(name);
	}
	
	public String getName(MapAreaOfEffect ab){
		return library.getFromFirstSet(ab);
	}
	
	public void put(String name, MapAreaOfEffect ab){
		library.put(name, ab);
	}
}
